#pragma once
#include <QWidget>

class SImageButton;
class QLineEdit;
class MainFrame;
class AppMenuPanel;

// TODO: should be configurable
class AppMenu : public QWidget {
  Q_OBJECT
 public:
  AppMenu(MainFrame* frame, QWidget* parent = nullptr);
  ~AppMenu();

 public slots:
  void onCommonPage(int* ids, int size, int ntype);

 protected:
  virtual bool eventFilter(QObject* watched, QEvent* event) override;
  virtual void enterEvent(QEvent* event) override;
  virtual void leaveEvent(QEvent* event) override;
  virtual void timerEvent(QTimerEvent* e) override;
  virtual void mousePressEvent(QMouseEvent* event) override;
  virtual void mouseReleaseEvent(QMouseEvent* event) override;

 signals:
  void setCommonPage(int* ids, int size, int ntype);

 private:
  void onShowMenu();
  void onHideMenu();
  void KillShowMenuTimer();
  void KillHideMenuTimer();

 private:
  SImageButton* m_btnLogo = nullptr;
  MainFrame* m_frame = nullptr;
  AppMenuPanel* m_appMenu = nullptr;
  int m_timerHideMenu = -1;
  int m_timerShowMenu = -1;
};